package com.ljf.finance.infra.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ljf.common.exception.ServiceException;
import com.ljf.common.infra.repository.impl.BasisRepositoryImpl;
import com.ljf.common.utils.CollectionUtil;
import com.ljf.finance.domain.repository.FinanceRelAccountReportDetailRepository;
import com.ljf.finance.dto.query.FinanceRelAccountReportDetailQuery;
import com.ljf.finance.infra.mapper.FinanceRelAccountReportDetailMapper;
import com.ljf.finance.model.FinanceRelAccountReportDetail;
import com.ljf.finance.vo.FinanceRelAccountReportDetailVO;
import org.springframework.stereotype.Component;

/**
 * 账户报表账户关联  数据访问接口实现
 *
 * @author LJF
 * @since 2024-12-07
 */
@Component
public class FinanceRelAccountReportDetailRepositoryImpl extends BasisRepositoryImpl<FinanceRelAccountReportDetailMapper, FinanceRelAccountReportDetail, FinanceRelAccountReportDetailQuery, FinanceRelAccountReportDetailVO> implements FinanceRelAccountReportDetailRepository {

    @Override
    protected QueryWrapper<FinanceRelAccountReportDetail> fillWrapper(FinanceRelAccountReportDetailQuery query, boolean sort) throws ServiceException {
        QueryWrapper<FinanceRelAccountReportDetail> wrapper = super.fillWrapper(query, sort);
        if (CollectionUtil.isNotEmpty(query.getDetailCodeList())) {
            wrapper.in(FinanceRelAccountReportDetail.COL_DETAIL_CODE, query.getDetailCodeList());
        }
        return wrapper;
    }

}
